﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient;assembly=Sinacor.Infra.UI.Controls">

    <!--BEGIN COMBOBOX-->
    <Style x:Key="ControlComboboxToggleButton" TargetType="{x:Type Controls:SinacorToggleButton}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="ClickMode" Value="Press"/>
        <Setter Property="CausesValidation" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:SinacorToggleButton}">
                    <Grid Margin="0,0.3,0,0.3">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition SharedSizeGroup="Combo" Width="15" />
                        </Grid.ColumnDefinitions>
                        <Border Background="{TemplateBinding Background}" Grid.Column="0"/>
                        <Border x:Name="Border" Background="{DynamicResource BrushButtonBackground}" Grid.Column="1" CornerRadius="4" BorderThickness="0.7" BorderBrush="{DynamicResource BrushComboBoxToggleButtonBorder}" Margin="1,0,0,0" Width="13"/>
                        <Path x:Name="Arrow" Data="{DynamicResource IconComboBoxArrowDown}" HorizontalAlignment="Center" Fill="{DynamicResource BrushComboBoxToggleButtonArrowFill}" VerticalAlignment="Center" Grid.Column="1" Margin="1.5,1,1.5,0"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="{DynamicResource BrushButtonBackgroundHover}" TargetName="Border"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="Background" Value="{DynamicResource BrushButtonBackgroundPressed}" TargetName="Border"/>
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushButtonBorderPressed}" TargetName="Border"/>
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter Property="Background" Value="{DynamicResource BrushComboboxGreen}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{DynamicResource BrushButtonForegroundDisabled}"/>
                            <Setter Property="Background" Value="{DynamicResource BrushButtonBackgroundDisabled}" TargetName="Border"/>
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushButtonBorderDisabled}" TargetName="Border"/>
                            <Setter Property="Fill" Value="{DynamicResource BrushComboBoxToggleButtonArrowFillDisabled}" TargetName="Arrow"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--ComboBoxItem Highlighted-->
    <ControlTemplate x:Key="ControlComboBoxItemHighlighted" TargetType="{x:Type Controls:SinacorComboBoxItem}">
        <Border Name="Border" SnapsToDevicePixels="True" Height="21" HorizontalAlignment="Stretch">
            <ContentControl x:Name="PART_ContentPresenter"
                               Content="{TemplateBinding ContentControl.Content}"
                               ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
                               ContentTemplateSelector="{TemplateBinding ContentControl.ContentTemplateSelector}"
                               VerticalAlignment="Center"
                               Style="{DynamicResource ControlFont}" Padding="8,0,0,0" Margin="8,0,0,0"/>
        </Border>
        <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Controls:SinacorComboBox}}, Path=IsEditable}" Value="True">
                <Setter Property="Margin" Value="4,0,0,0" TargetName="PART_ContentPresenter"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Controls:SinacorComboBox}}, Path=IsEditable}" Value="False">
                <Setter Property="Margin" Value="4,0,0,0" TargetName="PART_ContentPresenter"/>
            </DataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Controls:SinacorComboBox}}, Path=ItemTemplate}" Value="{x:Null}"/>
                    <Condition Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Controls:SinacorComboBox}}, Path=IsEditable}" Value="False"/>
                </MultiDataTrigger.Conditions>
                <Setter Property="Margin" Value="10,0,0,0" TargetName="PART_ContentPresenter"/>
            </MultiDataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Controls:SinacorComboBox}}, Path=ItemTemplate}" Value="{x:Null}"/>
                    <Condition Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Controls:SinacorComboBox}}, Path=IsEditable}" Value="True"/>
                </MultiDataTrigger.Conditions>
                <Setter Property="Margin" Value="10,0,0,0" TargetName="PART_ContentPresenter"/>
            </MultiDataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsHighlighted}" Value="True"/>
                    <Condition Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Controls:SinacorComboBox}}, Path=IsBlankLineFocused}" Value="False"/>
                </MultiDataTrigger.Conditions>
                <Setter Property="Panel.Background" TargetName="Border" Value="{DynamicResource BrushComboBoxItemBackgroundHighlighted}"/>
                <Setter Property="TextElement.Foreground" TargetName="PART_ContentPresenter" Value="{DynamicResource BrushComboBoxItemForegroundHighlighted}"/>
                <Setter Property="Margin" TargetName="PART_ContentPresenter" Value="10,0,10,0"/>
            </MultiDataTrigger>
        </ControlTemplate.Triggers>
        <ControlTemplate.Resources>
            <Style TargetType="{x:Type Controls:SinacorLabel}">
                <Setter Property="Template" Value="{DynamicResource ControlLabel}"/>
                <Setter Property="Foreground" Value="{DynamicResource BrushComboboxItem}"/>
                <Setter Property="Padding" Value="0,0,0,0" />
                <Setter Property="Margin" Value="4,5,0,0" />
            </Style>
            <Style TargetType="{x:Type Controls:SinacorCheckBox}">
                <Setter Property="Template" Value="{DynamicResource ControlCheckBox}"/>
                <Setter Property="Foreground" Value="{DynamicResource BrushComboboxItem}"/>
            </Style>
            <Style TargetType="{x:Type Controls:SinacorRadioButton}">
                <Setter Property="Template" Value="{DynamicResource ControlRadioButton}"/>
                <Setter Property="Foreground" Value="{DynamicResource BrushComboboxItem}"/>
            </Style>
        </ControlTemplate.Resources>
    </ControlTemplate>

    <!--ComboBoxItem Normal-->
    <Style TargetType="{x:Type Controls:SinacorComboBoxItem}">
        <Setter Property="TextElement.Foreground" Value="{DynamicResource BrushComboBoxForeground}"/>
        <Setter Property="UIElement.SnapsToDevicePixels" Value="True"/>
        <Setter Property="FrameworkElement.FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:SinacorComboBoxItem}">
                    <Border Name="Border" SnapsToDevicePixels="True" Height="21" HorizontalAlignment="Stretch" Background="{DynamicResource BrushComboBoxItemBackground}">
                        <ContentControl
                               x:Name="PART_ContentPresenter"
                               Content="{TemplateBinding ContentControl.Content}"
                               ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
                               ContentTemplateSelector="{TemplateBinding ContentControl.ContentTemplateSelector}"
                               VerticalAlignment="Center"
                               HorizontalAlignment="Stretch"
                               Style="{DynamicResource ControlFont}" Margin="4,0,4,0"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Controls:SinacorComboBox}}, Path=ItemTemplate}" Value="{x:Null}">
                            <Setter Property="Margin" Value="10,0,10,0" TargetName="PART_ContentPresenter"/>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsHighlighted}" Value="True"/>
                    <Condition Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Controls:SinacorComboBox}}, Path=IsBlankLineFocused}" Value="False"/>
                </MultiDataTrigger.Conditions>
                <Setter Property="Template" Value="{StaticResource ControlComboBoxItemHighlighted}"/>
            </MultiDataTrigger>
        </Style.Triggers>
    </Style>

    <!--ComboBox Editável-->
    <ControlTemplate x:Key="ControlComboBoxEditable" TargetType="{x:Type Controls:SinacorComboBox}">
        <ControlTemplate.Resources>
            <Style TargetType="{x:Type Controls:SinacorTextBox}">
                <Setter Property="OverridesDefaultStyle" Value="true"/>
                <Setter Property="AllowDrop" Value="true"/>
                <Setter Property="MinWidth" Value="0"/>
                <Setter Property="MinHeight" Value="0"/>
                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                <Setter Property="FontFamily" Value="Tahoma"/>
                <Setter Property="FontWeight" Value="Normal"/>
                <Setter Property="FontStyle" Value="Normal"/>
                <Setter Property="FontSize" Value="11"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Controls:SinacorTextBox}">
                            <Border x:Name="Border" BorderBrush="{DynamicResource BrushComboboxRed}" BorderThickness="0" HorizontalAlignment="Stretch" Background="{DynamicResource BrushComboBoxTextBoxBackground}" CornerRadius="4">
                                <ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" Margin="2,2,0,0" HorizontalAlignment="Left" Width="{Binding ActualWidth, ElementName=Border}"/>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Foreground" Value="{DynamicResource BrushComboBoxForegroundDisabled}"/>
                                    <Setter Property="Background" TargetName="Border" Value="{DynamicResource BrushComboBoxBackgroundDisabled}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ControlTemplate.Resources>
        <Grid SnapsToDevicePixels="true">
            <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{DynamicResource BrushComboBoxBorder}" BorderThickness="0.7" Padding="0.7,0.7,0.7,1" CornerRadius="4">
                <Grid Grid.IsSharedSizeScope="true">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition SharedSizeGroup="Combo" Width="15"/>
                    </Grid.ColumnDefinitions>
                    <WrapPanel Orientation="Horizontal" x:Name="PART_TextLoading" Visibility="Collapsed">
                        <TextBlock Grid.Column="0" Text="{DynamicResource Infra.Controls.Label.Carregando}" Margin="1,1,0,0" Padding="2.3,1,0,0" Style="{DynamicResource ControlFont}"/>
                        <TextBlock Grid.Column="0" Text="..." Margin="0.5,1,0,0" Padding="0,1,0,0"/>
                    </WrapPanel>
                    <ContentPresenter Grid.Column="0" x:Name="PART_EditTemplate" ContentTemplate="{TemplateBinding EditTemplate}" ContentTemplateSelector="{TemplateBinding EditTemplateSelector}" Margin="2.5,1,0,0" HorizontalAlignment="Stretch"/>
                    <Controls:SinacorToggleButton x:Name="PART_ToggleButton" Style="{StaticResource ControlComboboxToggleButton}" Background="{x:Null}" Grid.ColumnSpan="2" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1,0.5,0,0"/>
                </Grid>
            </Border>
            <Popup x:Name="PART_Popup" Focusable="False" IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" Width="Auto" Height="Auto" MinWidth="{TemplateBinding ActualWidth}" MaxWidth="{TemplateBinding ActualWidthPopUp}" MaxHeight="{TemplateBinding HeightPopup}">
                <Border x:Name="DropDownBorder" Background="{DynamicResource BrushComboBoxPopupBackground}" BorderBrush="{DynamicResource BrushComboBoxPopupBorder}" BorderThickness="0.7" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                    <Controls:SinacorScrollViewer Width="Auto" Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Button Grid.Row="0" Height="21" Visibility="Collapsed" x:Name="PART_Blank" HorizontalAlignment="Stretch" Background="{DynamicResource BrushComboBoxItemBackground}">
                                <Button.Style>
                                    <Style TargetType="Button">
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="Button">
                                                    <Border Background="{TemplateBinding Background}" x:Name="Border">
                                                        <ContentPresenter/>
                                                    </Border>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </Button.Style>
                            </Button>
                            <ItemsPresenter Grid.Row="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Contained"/>
                        </Grid>
                    </Controls:SinacorScrollViewer>
                </Border>
            </Popup>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="HasItems" Value="false">
                <Setter Property="MinHeight" TargetName="PART_Popup" Value="72"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="BorderBrush" Value="{DynamicResource BrushComboBoxBorderDisabled}" TargetName="Border"/>
                <Setter Property="Foreground" Value="{DynamicResource BrushComboBoxForegroundDisabled}"/>
                <Setter Property="Margin" Value="1,1,0,0" TargetName="PART_ToggleButton"/>
            </Trigger>
            <Trigger Property="IsGrouping" Value="true">
                <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
            </Trigger>
            <Trigger Property="IsBlankLineFocused" Value="True">
                <Setter Property="Background" Value="{DynamicResource BrushComboBoxItemBackgroundHighlighted}" TargetName="PART_Blank"></Setter>
            </Trigger>
            <Trigger Property="IsLoading" Value="True">
                <Setter Property="Foreground" Value="{DynamicResource BrushComboBoxLoadingForeground}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource BrushComboBoxBorderDisabled}" TargetName="Border"/>
                <Setter Property="Visibility" Value="Collapsed" TargetName="PART_EditTemplate"/>
                <Setter Property="IsEnabled" Value="False" TargetName="PART_ToggleButton"/>
                <Setter Property="Visibility" Value="Visible" TargetName="PART_TextLoading"/>
                <Setter Property="Background" Value="{DynamicResource BrushComboBoxBackgroundDisabled}" TargetName="PART_TextLoading"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!--ComboBox Não Editável-->
    <Style TargetType="{x:Type Controls:SinacorComboBox}">
        <Setter Property="Foreground" Value="{DynamicResource BrushComboBoxForeground}"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Height" Value="21"/>
        <Setter Property="Width" Value="100"/>
        <Setter Property="HeightPopup" Value="200" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:SinacorComboBox}">
                    <ControlTemplate.Resources>
                        <Style TargetType="{x:Type Controls:SinacorLabel}">
                            <Setter Property="Foreground" Value="{DynamicResource BrushComboBoxForeground}"/>
                            <Setter Property="Background" Value="{DynamicResource BrushComboBoxBackground}"/>
                            <Setter Property="Padding" Value="0,0,0,1.5"/>
                            <Setter Property="HorizontalContentAlignment" Value="Left"/>
                            <Setter Property="VerticalContentAlignment" Value="Bottom"/>
                            <Setter Property="VerticalAlignment" Value="Top"/>
                            <Setter Property="Height" Value="21"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type Controls:SinacorLabel}">
                                        <Border SnapsToDevicePixels="true" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                                            <ContentPresenter 
                                                x:Name="PART_ContentPresenter"
                                                HorizontalAlignment="Stretch" 
                                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                                RecognizesAccessKey="True"
                                                Style="{DynamicResource ControlFont}" Margin="4,0,0,0"/>
                                        </Border>
                                        <ControlTemplate.Triggers>
                                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Controls:SinacorComboBox}}, Path=IsSelectionBoxHighlighted}" Value="True">
                                                <Setter Property="Foreground" Value="{DynamicResource BrushComboBoxSelectedItemForeground}"/>
                                            </DataTrigger>
                                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Controls:SinacorComboBox}}, Path=ItemTemplate}" Value="{x:Null}">
                                                <Setter Property="Margin" Value="2,0,0,0" TargetName="PART_ContentPresenter"/>
                                            </DataTrigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ControlTemplate.Resources>

                    <Grid SnapsToDevicePixels="true">
                        <Border x:Name="Border" CornerRadius="4" Background="{TemplateBinding Background}" BorderBrush="{DynamicResource BrushComboBoxBorder}" BorderThickness="0.7" Padding="0.7,0.5,0.7,1">
                            <Grid Grid.IsSharedSizeScope="true">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition SharedSizeGroup="Combo" Width="15"/>
                                </Grid.ColumnDefinitions>
                                <Border Width="Auto">
                                    <Rectangle x:Name="Rectangle" Fill="{DynamicResource BrushComboBoxBackground}" Margin="1,1,0,0.3"/>
                                </Border>
                                <WrapPanel Orientation="Horizontal" x:Name="PART_TextLoading" Margin="1,1,0,0" HorizontalAlignment="Stretch" Visibility="Collapsed">
                                    <TextBlock Grid.Column="0" Text="{DynamicResource Infra.Controls.Label.Carregando}" Padding="2.3,1,0,0" Style="{DynamicResource ControlFont}"/>
                                    <TextBlock Grid.Column="0" Text="..." Margin="0.5,0,0,0" Padding="0,1,0,0"/>
                                </WrapPanel>
                                <Controls:SinacorLabel
                                    x:Name="PART_DisplayPresenter"
                                    Content="{TemplateBinding ComboBox.SelectionBoxItem}"                                   
								    ContentTemplate="{TemplateBinding ComboBox.SelectionBoxItemTemplate}"
								    ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                                    Padding="0,0,0,0" Margin="-30,-2,0,0"
                                    HorizontalAlignment="Stretch"
                                    />
                                <Controls:SinacorToggleButton Name="PART_ToggleButton" Style="{StaticResource ControlComboboxToggleButton}" Grid.ColumnSpan="3" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="0,0.7,0,0"/>
                            </Grid>
                        </Border>
                        <Popup x:Name="PART_Popup" Focusable="False" IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" Width="Auto" Height="Auto" MinWidth="{TemplateBinding ActualWidth}" MaxWidth="{TemplateBinding ActualWidthPopUp}" MaxHeight="{TemplateBinding HeightPopup}">
                            <Border x:Name="DropDownBorder" Background="{DynamicResource BrushComboBoxPopupBackground}" BorderBrush="{DynamicResource BrushComboBoxPopupBorder}" BorderThickness="0.8" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                                <Controls:SinacorScrollViewer Width="Auto" Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <Button Grid.Row="0" Height="21" Visibility="Collapsed" x:Name="PART_Blank" HorizontalAlignment="Stretch" Background="{DynamicResource BrushComboBoxItemBackground}">
                                            <Button.Style>
                                                <Style TargetType="Button">
                                                    <Setter Property="Template">
                                                        <Setter.Value>
                                                            <ControlTemplate TargetType="Button">
                                                                <Border Background="{TemplateBinding Background}" x:Name="Border">
                                                                    <ContentPresenter/>
                                                                </Border>
                                                            </ControlTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </Style>
                                            </Button.Style>
                                        </Button>
                                        <ItemsPresenter Grid.Row="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Contained"/>
                                    </Grid>
                                </Controls:SinacorScrollViewer>
                            </Border>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding ItemTemplate}" Value="{x:Null}">
                            <Setter Property="Padding" Value="5,0,0,0" TargetName="PART_DisplayPresenter"/>
                            <Setter Property="Margin" Value="-1,-4,0,0" TargetName="PART_DisplayPresenter"/>
                        </DataTrigger>
                        <Trigger Property="IsSelectionBoxHighlighted" Value="true">
                            <Setter Property="Foreground" Value="{DynamicResource BrushComboBoxSelectedItemForeground}" TargetName="PART_DisplayPresenter"/>
                            <Setter Property="Fill" Value="{DynamicResource BrushComboBoxSelectedItemBackground}" TargetName="Rectangle"/>
                            <Setter Property="StrokeDashArray" Value="2 2" TargetName="Rectangle"/>
                            <Setter Property="Stroke" Value="{DynamicResource BrushComboBoxSelectedItemBorder}" TargetName="Rectangle"/>
                        </Trigger>
                        <Trigger Property="HasItems" Value="false">
                            <Setter Property="MinHeight" TargetName="PART_Popup" Value="72"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{DynamicResource BrushComboBoxForegroundDisabled}"/>
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushComboBoxBorderDisabled}" TargetName="Border"/>
                            <Setter Property="Fill" TargetName="Rectangle" Value="{DynamicResource BrushComboBoxBackgroundDisabled}"/>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>
                        <Trigger Property="IsBlankLineFocused" Value="True">
                            <Setter Property="Background" Value="{DynamicResource BrushComboBoxSelectedItemBackground}" TargetName="PART_Blank"/>
                        </Trigger>
                        <Trigger Property="IsLoading" Value="True">
                            <Setter Property="Foreground" Value="{DynamicResource BrushComboBoxLoadingForeground}"/>
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushComboBoxBorderDisabled}" TargetName="Border"/>
                            <Setter Property="Fill" Value="{DynamicResource BrushComboBoxBackgroundDisabled}" TargetName="Rectangle"/>
                            <Setter Property="Visibility" Value="Visible" TargetName="PART_TextLoading"/>
                            <Setter Property="Visibility" Value="Collapsed" TargetName="PART_DisplayPresenter"/>
                            <Setter Property="IsEnabled" Value="False" TargetName="PART_ToggleButton"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <Border BorderBrush="{DynamicResource BrushComboBoxBorderError}" BorderThickness="1" CornerRadius="4" HorizontalAlignment="Left" Width="{Binding ActualWidth, ElementName=PART_Content}" Height="{Binding ActualHeight, ElementName=PART_Content}">
                        <AdornedElementPlaceholder x:Name="PART_Content" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="-1"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsEditable" Value="true">
                <Setter Property="IsTabStop" Value="false"/>
                <Setter Property="Padding" Value="0,1"/>
                <Setter Property="Template" Value="{StaticResource ControlComboBoxEditable}"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    <!--END COMBOBOX-->

    <!--**************************************************************************************
    Estilos dos controles do SinacorDataGrid 
    **************************************************************************************-->

    <Style x:Key="ControlDataGridSinacorComboBox"  TargetType="{x:Type Controls:SinacorComboBox}" BasedOn="{StaticResource {x:Type Controls:SinacorComboBox}}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="1,4.5,1.5,1"/>
        <Setter Property="Border.CornerRadius" Value="0"/>
        <Setter Property="ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <Border BorderBrush="{DynamicResource BrushComboBoxBorderError}" BorderThickness="1" CornerRadius="0" HorizontalAlignment="Left" Width="{Binding ActualWidth, ElementName=PART_Content}" Height="{Binding ActualHeight, ElementName=PART_Content}">
                        <AdornedElementPlaceholder x:Name="PART_Content" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="-1"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>
